//
//  BanJiKaoQingNextViewCell.m
//  SanYiTeaching
//
//  Created by 李文强 on 2019/4/16.
//  Copyright © 2019 SanYi. All rights reserved.
//

#import "BanJiKaoQingNextViewCell.h"

@implementation BanJiKaoQingNextViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if ([super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self initSubView];
    }
    return self;
}

- (void)initSubView{
    UILabel *contLab = [UILabel new];
    CGFloat W = 1.0/7;
    for (int i = 0; i<7; i++) {
        if (i == 0) {
            UILabel *label = [[UILabel alloc]init];
            label.textAlignment = 1;
            label.textColor = TITLECOLOR;
            label.font = [UIFont systemFontOfSize:12];
            [self addSubview:label];
            label.tag = 20+i;
            contLab = label;
            [label mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.equalTo(@0);
                make.centerY.equalTo(self.mas_centerY);
                make.width.equalTo(self).multipliedBy(W);
                make.height.mas_equalTo(40);
            }];
        } else if(i<6){
            UILabel *label = [[UILabel alloc]init];
            label.textAlignment = 1;
            label.textColor = TITLECOLOR;
            label.font = [UIFont systemFontOfSize:12];
            [self addSubview:label];
            label.tag = 20+i;
            [label mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.equalTo(contLab.mas_right);
                make.centerY.equalTo(self.mas_centerY);
                make.width.equalTo(self).multipliedBy(W);
                make.height.mas_equalTo(40);
            }];
            contLab = label;
        }else{
            _checkButton = [UIButton buttonWithType:UIButtonTypeSystem];
            [_checkButton setTitle:@"查看" forState:UIControlStateNormal];
            _checkButton.titleLabel.font = [UIFont systemFontOfSize:12];
            _checkButton.tag = 20+i;
            contLab.userInteractionEnabled = YES;
            [self addSubview:_checkButton];
            [_checkButton mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.equalTo(contLab.mas_right);
                make.centerY.equalTo(self.mas_centerY);
                make.width.equalTo(self).multipliedBy(W);
                make.height.mas_equalTo(40);
            }];
        }
    }
}
- (void)reloadViewLayout:(NSArray *)array{
    for (int i = 0; i<array.count; i++) {
        UILabel *label = (UILabel *)[self viewWithTag:20+i];
        label.text = array[i];
    }
}
@end
